home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Gold Medal Software 5
/
Gold Medal Software - Volume 5 (Gold Medal) (1995).iso
/
windows
/
win31
/
cenviw.arj
/
WINTOOLS.CMM
< prev
next >
Wrap
Text File
|
1994-03-08
|
3KB
|
95 lines
//******************************************************************
//*** WinTools.cmm - CEnvi demonstration program to show the ***
//*** ver.1 capabilities of the WinTools.lib functions. ***
//******************************************************************
#include <WinTools.lib>
printf("Moving CEnvi text window to middle of the screen...");
// Change size of CEnvi window so that it is 1/4 screen height and full width
// and 1/2 of screen width
GetScreenSize(ScreenWidth,ScreenHeight);
SetSize(ScreenHandle(),width = ScreenWidth,height = ScreenHeight / 4);
// now center this in the screen
SetPosition(ScreenHandle(),(ScreenWidth - width) / 2,(ScreenHeight - height) / 2);
// Start up NotePad
printf("\nStarting notepad...");
if ( IsWindow("notepad") ) {
printf("\n\n\aERROR: Notepad must NOT be running to run this test.");
printf("\nPress any key to quit...");
getch();
exit(1);
}
if ( -1 == spawn(P_NOWAIT,"NotePad.exe") ) {
printf("\n\n\aERROR: Cannot start NotePad.exe");
printf("\nPress any key to quit...");
getch();
exit(1);
}
// Restore this CEnvi screen as the active one
SetActiveWindow(ScreenHandle());
printf("\nPress any key to move NotePad to upper-left corner...");
getch();
SetPosition("notepad",0,0);
printf("\nPress any key to move NotePad to bottom-right corner...");
getch();
GetSize("notepad",width,height);
SetPosition("notepad",ScreenWidth - width,ScreenHeight - height);
printf("\nPress any key to fit notepad in top center...");
getch();
// make 1/2 width of screen height and width, and center at top
SetSize("notepad",ScreenWidth / 2,ScreenHeight / 2);
SetPosition("notepad",ScreenWidth / 4,0);
printf("\nPress any key to hide notepad...");
getch();
ShowWindow("notepad",SW_HIDE);
printf("\nPress any key to show notepad...");
getch();
ShowWindow("notepad",SW_SHOWNOACTIVATE);
printf("\nPress any key to minimize notepad...");
getch();
ShowWindow("notepad",SW_MINIMIZE);
printf("\nPress any key to maximize notepad...");
getch();
ShowWindow("notepad",SW_SHOWMAXNOACTIVE);
printf("\nPress any key to restore notepad...");
getch();
ShowWindow("notepad",SW_RESTORENOACTIVE);
printf("\n\nFinally, will minimize CEnvi and we're done.");
printf("\nPress any key to change notepad's title...");
getch();
printf("\nKill notepad, or press any key to end this test...");
// Make notepad the active window
SetActiveWindow("notepad");
// Minimize this CEnvi window
ShowWindow(ScreenHandle(),SW_MINIMIZE);
// Get notepad's handle because its name will change
NotepadHandle = GetWindowHandle("notepad");
// Finally, as long as notepad exists, rotate the advertisement
NewTitle = " I like CEnvi. CEnvi is swell! Thank you, Nombas. ";
TitleLen = strlen(NewTitle);
while( IsWindow(NotepadHandle) && !kbhit() ) {
// set to new title
SetWindowTitle(NotepadHandle,NewTitle);
// rotate title one character left
NewLastChar = NewTitle[0];
strcpy(NewTitle,NewTitle + 1);
NewTitle[TitleLen-1] = NewLastChar;
}